#!/bin/bash
## kola:
##   exclusive: false
##   description: Verify files in /usr/lib/systemd/system-generators are executable.

set -xeuo pipefail

# shellcheck disable=SC1091
. "$KOLA_EXT_DATA/commonlib.sh"

find /usr/lib/systemd/system-generators -type f | while read -r f; do
    mode=$(stat -c '%a' "${f}")
    if [[ "${mode}" != 555 ]] && [[ "${mode}" != 755 ]]; then
        fatal "Error: generator is not executable: ${f}. Expected mode 555 or 755, found ${mode}"
    fi
done
ok "system-generators are executable"
